var type ="";
function detectOS() {
	var osUserAgent = navigator.userAgent.toLowerCase();
	if (osUserAgent.indexOf("iphone") > -1 || osUserAgent.indexOf("ipad") > -1 || osUserAgent.indexOf("ipod") > -1) {//判断是否是ios
		type ="ios";
    }
    if (osUserAgent.indexOf("android") > -1 || osUserAgent.indexOf("adr") > -1) {//判断是否是安卓
        type ="android";
    }
    
}detectOS();

function downloadApp(type) {
	if (type=="ios") {
		//alert(type)
		window.location.href = 'https://itunes.apple.com/cn/app/%E6%A1%89%E6%A0%91ibc/id1382113157?mt=8';
	} else if(type=="android"){
		//alert(type)
        $.ajax({
            url: '/euc/_app/version',
            data:'',
            dataType: 'JSON',
            async: true,
            contentType:'application/json;charset=utf-8',
            type: 'POST',
            success: function (datas, textStatus, response) {
                var data = datas.data;
                window.location.href = data.android_version.downloadUrl;
            },
            error: function () {
                console.log("/euc/_app/version error");
            }
        });
	}
}